<!DOCTYPE html>
<html>
	<head>
		<#include "/templates/commons/head.html">
		<script type="text/javascript">
			/**
			*点击查询按钮，查询用户列表
			*/
			function query(){
				document.opForm.action = "${ctx!}/MenuController/getMenuList.do";
				document.opForm.submit();
			}
			/**
			*点击添加按钮进入添加页面
			*/
			function add(){
				document.opForm.action = "${ctx!}/MenuController/add.do";
				document.opForm.submit();
			}
			/**
			*点击添加按钮进入添加页面
			*/
			function edit(id){
				document.opForm.action = "${ctx!}/MenuController/edit.do?menuId=" + id;
				document.opForm.submit();
			}
			/**
			*点击添加按钮进入添加页面
			*/
			function del(){
			    if(seleBox("ids")){
				    layer.confirm("您是否确定要删除？", {
					    	btn: ['确定', '取消']
						}, function() {
						    document.opForm.action = "${ctx!}/MenuController/deleteMenu.do";
							document.opForm.submit();
						}, function() {
					});
				}
			}
		</script>
	</head>
	<body>
		<div id="div-body" class="body">
			<form id="opForm" name="opForm" method="post" class="layui-form">
				<div class="search-head">
			        <!-- 顶部搜索&按钮栏 Start -->
			        <blockquote class="layui-elem-quote">
						<!-- 头部右边搜索条件 Start -->
			            <div class="layui-form layui-list-btn-group">
		                	<!-- 关键字搜索 Start -->
		                	<div class="input-block">
			                	<label class="layui-form-label">关键字</label>
			                    <div class="layui-input-inline">
			                        <input type="text" name="name" placeholder="请输入关键字" title="菜单号、父级菜单、菜单名称、请求路径、菜单图片" autocomplete="off" class="layui-input">
			                    </div>
		                	</div>
		                	<!-- 关键字搜索 End -->
			            </div> 
			            <!-- 头部右边搜索条件 End -->
					</blockquote>
		        	<!-- 按钮 Start -->
			        <blockquote class="layui-elem-quote list-btn-group">
						<div class="layui-btn-group">
							<#if Session.CUR_MENU.addRole == 1>
								<button class="layui-btn" type="button" onclick="add();"><i class="layui-icon">&#xe654;</i>新增</button>
							</#if>
							<#if Session.CUR_MENU.deleteRole == 1>
								<button class="layui-btn" type="button" onclick="del();"><i class="layui-icon">&#xe640;</i>删除</button>
							</#if>
						</div>
						<#if Session.CUR_MENU.selectRole == 1>
							<button class="layui-btn query-btn layui-btn-danger" type="button" onclick="query();"><i class="layui-icon">&#xe615;</i>查询</button>
						</#if>
			        </blockquote>
					<!-- 按钮 End -->
			        <!-- 顶部搜索&按钮栏End -->
		        </div>
		        <!-- table list group Start -->
		        <div id="container">
		        	<!-- message Start -->
		        	<div id="div-message">${message!}</div>
		        	<!-- message End -->
		        	<!-- table list Start -->
		        	<div class="data-grid-group">
		        		<table lay-filter="data-grid" class="layui-table dymanic-table">
		        			<thead>
		        				<tr>
									<th lay-data="{field:'ids', align: 'center', checkbox: true, width: '5%'}"></th>
									<th lay-data="{field:'menuId', align: 'center', width: '10%'}">菜单号</th>
									<th lay-data="{field:'menuName', align: 'left', sort:true, width: '15%'}">菜单名称</th>
									<th lay-data="{field:'menuPath', align: 'left', width: '20%'}">请求路径</th>
									<th lay-data="{field:'menuLevelName', align: 'center', width: '10%'}">菜单级别</th>
									<th lay-data="{field:'menuImage', align: 'center', width: '10%'}">菜单图片</th>
									<th lay-data="{field:'parentMenu', align: 'center', width: '10%'}">父级菜单</th>
									<th lay-data="{field:'menuUse', align: 'center', width: '10%'}">使用级别</th>
									<th lay-data="{field:'menuType', align: 'center', width: '10%'}">菜单类型</th>
								</tr>
							</thead>
							<tbody>
								<#if list?exists>
									<#list list as MenuBean>
										<tr>
											<td><input name="ids" type="checkbox" value="${MenuBean.menuId!''}"/></td>
											<td>${MenuBean.menuId!'-'}</td>
											<td title="${MenuBean.menuName!''}"><a href="javascript:;" class="" onclick="edit('${MenuBean.menuId}')">${MenuBean.menuName!'-'}</a></td>
											<td class="ellipsis150" title="${MenuBean.menuPath}">${MenuBean.menuPath!'-'}</td>
											<td>${MenuBean.menuLevelName!'-'}</td>
											<td><i class="layui-icon" data-icon="${MenuBean.menuImage!''}">${MenuBean.menuImage!'-'}</i></td>
											<td>${MenuBean.parentMenu!'-'}</td>
											<td>${MenuBean.menuUse!'-'}</td>
											<td>${MenuBean.menuTypeName!'-'}</td>
										</tr>
									</#list>
								</#if>
							</tbody>
		        		</table>
		        	</div>
		        	<!-- table list End -->
	        	</div>
	        	<!-- table list group End -->
        	</form>
       	</div>
	</body>
</html>